#include <stdio.h>
#define INT_KIND 0
#define DOUBLE_KIND 1

typedef struct 
    {
        int kind;
        union {
            int i;
            double d;
        };
    } Number;

void print_number(Number num);

int main(void)
{

    Number n, m;
    n.kind = INT_KIND;
    n.i = 5;
    m.kind = DOUBLE_KIND;
    m.d = 5.2556;

    print_number(n);
    print_number(m);
}

void print_number(Number num)
{
    if (num.kind == INT_KIND)
        printf("%d\n", num.i);
    else
        printf("%g\n", num.d);
}
